using Pangoo;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using UnityEngine;
using Sirenix.OdinInspector;
using Pangoo.Core.VisualScripting;
using Pangoo.MetaTable;
using Pangoo.Common;
using Pangoo.Core.Common;
using Pangoo.Core.Services;


namespace CardCombine
{
    public class CardService : MainSubService
    {
        public override int Priority => 7;
        CardConfig Config;

        public UICardCombinePanel Panel;

        protected override void DoStart()
        {
            Config = GameMainConfigSrv.GetConfig<CardConfig>();
            if (Config == null)
            {
                LogError($"卡片配置是Null");
            }

            if (Config.CardHasVariable.IsNullOrWhiteSpace())
            {
                LogError($"卡片的拥有变量未设置!");
            }

            if (Config.CardRemovedVariable.IsNullOrWhiteSpace())
            {
                LogError($"卡片的移除变量未设置!");
            }

            var panelUuid = Config?.CardPanelUuid;

            if (!panelUuid.IsNullOrWhiteSpace())
            {
                // #if SIDE_EFFECT
                UISrv.ShowUI(panelUuid, showAction: (o) =>
                {
                    Panel = o as UICardCombinePanel;
                });
            }

        }

    }
}